<?php    /**     * Given a username, load the proper profile     */	function loadProfile($username, $page)	{		/* general data */		$CI = & get_instance();		$CI->load->model(array('User_model','Achievements_model','Friends_model', 'TodoAchievements_model', 'CompletedAchievements_model'));		$userData = $CI->User_model->get_user_by_username($username);		$CI->data['userData'] = $userData;		$CI->data['todoAchievementsCount'] = $CI->TodoAchievements_model->get_count_todo_achievements($userData->id);		$CI->data['completedAchievementsCount'] = $CI->CompletedAchievements_model->get_count_completed_achievements($userData->id);		$CI->data['friendsCount'] = $CI->Friends_model->get_count_friends($userData->id);				/* per-page data */		if($page == 'friends')		{			$CI->data['friendsList'] = $CI->Friends_model->get_friends($userData->id);		}	}?> 